<?php namespace Core\Myapp\Database;

class Connection
{
    public function createConnection()
    {
        $dsn = 'mysql:dbname=' . DB_DATABASE . ';host=' . DB_HOST;
        try {
            $conn = new \PDO($dsn, DB_USERNAME, DB_PASSWORD);
            $conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
            return $conn;
        } catch (\PDOException $e) {
            echo 'Database connection failed: ' . $e->getMessage();
        }
    }
}